import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_base/config/app_color.dart';

class SwitchWidget extends StatelessWidget {
  const SwitchWidget({
    Key? key,
    required this.value,
    this.onChanged,
    this.activeColor,
    this.trackColor,
    this.thumbColor,
    this.width,
    this.height,
  }) : super(key: key);
  final bool value;
  final Color? activeColor;
  final Color? trackColor;
  final Color? thumbColor;
  final ValueChanged<bool>? onChanged;
  final double? width;
  final double? height;

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: width ?? 38.w,
      height: height ?? 24.w,
      child: FittedBox(
        fit: BoxFit.fitWidth,
        child: CupertinoSwitch(
          value: value,
          onChanged: onChanged,
          activeColor: activeColor ?? AppColor.primary,
          thumbColor: thumbColor ?? Colors.white,
          trackColor: trackColor ?? AppColor.primary,
        ),
      ),
    );
  }
}
